Interactive geographic maps, e.g., maps provided by a web map service, can provide a visual representation of a geographic region. An interactive geographic map for a particular geographic region can also describe various features that appear in the particular geographic region. For example, an interactive geographic map can describe line features, e.g., roads and rivers, area features, e.g., countries, parcels, forests, and lakes, and point features, e.g., villages and cities. Each feature in an interactive geographic map can be labeled, e.g., annotated, by positioning, near the feature and in the interactive geographic map, one or more labels, e.g., map labels, that describe the feature. For example, an interactive geographic map that includes a point feature referencing the city of San Francisco can be labeled by placing a label “San Francisco” near the point feature.
Computerized methods can be used to automatically position respective labels near features in an interactive geographic map. Such computerized methods can be configured to label features in an interactive geographic map based on predefined rules, e.g., repeat labels for roads or place labels for point features in a position that is located northwest direction of the point features. These computerized methods can also apply various algorithms, e.g., simulated annealing, genetic algorithms, etc., to optimize the placement of labels for features in an interactive geographic map. For example, various algorithms can be applied to position labels in an interactive geographic map in a manner that avoids overlap with other labels.
Since the size of labels can vary, each label is generally enclosed by a bounding box, e.g., a polygon, which defines how a label will be rendered in a geographic map. For example, instead of displaying a label for “Ride the Geese of Seattle at Lake Union” on one line, a smaller bounding box can be used to fit the label so the label is displayed across two lines. Defining the size, e.g., width, of a bounding box can affect how labels are rendered in a geographic map. For example, defining a too large of a width for a bounding box can result in some labels, e.g., “Lake Union Park Hotel” being displayed on a single line. Similarly, defining too small of a width for a bounding box can result in some labels, e.g., “Ride the Geese of Seattle at Lake Union” being displayed across too many lines.
Moreover, bounding boxes are can also have a specified respective buffer that is used to help identify collisions between rendered labels. For example, a collision can be identified when respective buffers for two rendered labels overlap. Upon collision, at least one of the two labels will no longer be displayed in an interactive geographic map.